package cn.lg.soar.database.model;

import cn.lg.soar.database.query.ConditionEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import java.text.MessageFormat;

/**
 * @author luguoxiang 469599794@qq.com
 * @Date: 2023/10/28 16:54
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
@Getter
@Setter
public class DataScopeRule {

    @ApiModelProperty("字段")
    private String field;

    @ApiModelProperty("条件")
    private ConditionEnum condition;

    @ApiModelProperty("值")
    private String value;

    public String toSqlExpression() {
        return MessageFormat.format(condition.getExpression(), field, value);
    }

}
